<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>文本和值</title>
  <script src="js/jquery-3.7.1.min.js"></script>
  <script type="text/javascript">
    $(function () {
      $("#u").focus(function () {
        var value = this.value;
        if (value === this.defaultValue) {
          $(this).val("");
        }
      })
      $("#u").blur(function () {
        var value = this.value;
        if (value === "") {
          $(this).val(this.defaultValue);
        }
      })
    })
  </script>
</head>
<body>
<h1>用户登录</h1>
u: <input type="text" id="u" value="用户邮箱/手机号/用户名"><br/><br/>
p: <input type="password" id="p"><br/><br/>
<input type="button" value="登陆">
</body>
</html>
